home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / qbsub10.arc / LMENUDMO.ASC < prev    next >
Encoding:
Text File  |  1986-06-25  |  2.8 KB  |  75 lines

  1. ' LMENUDMO.ASC -- MSDOS QuickBASIC LMENU.SUB subroutines demo    25 June 86
  2. '        by David L. Poskie     (608) 274-9560
  3. '                  7118 Raymond Rd. Madison, WI 53719
  4. ' Please run any suggestions, corrections, additions, or changes by me.
  5. ' I can be messaged on all the major Madison, WI RBBS's.
  6.     
  7. '      This demo takes you through using the subroutines, step-by-step
  8.     ' You can alter these dimensions to fit your needs. As it stands,
  9.     '  LMENU will handle up to 11 menus with 9 selections per menu.
  10.     DIM Menu$(10 , 10) , NumSelects(10) 
  11.  
  12. GOTO Start
  13.     ' I like the include files right up front -- they are in QBSUBnn.ARC.
  14.     Rem    $Include: 'LMENU.SUB'
  15.     Rem    $Include: 'OMNI.SUB'
  16.  
  17. Start:
  18.     COLOR 14 , 3 , 8        ' Arbitrary - anything you want
  19.  
  20. LMenuData:        
  21.     ' Menu DATA begins -- replace with your own menu data.
  22.     ' The prompt comes first,
  23.     '     then menu selections,
  24.     '       then terminator/s:    ` * ' = end of that menu 
  25.     '                ` $ ' = end of all menus.
  26.     ' Once you understand the format, there is no need for spaces
  27.     '   in the DATA lines.
  28.  
  29.         '  Prompt           Selections                                  Terms
  30.       DATA PROMPT          ,Sel A,Sel B,Sel C,Sel D,None                 ,*
  31.       DATA Ingredient      ,Parsley,Sage,Rosemary,Thyme,Done             ,*
  32.       DATA Your Preference ,Life,Liberty,Pursuit of Happiness,EXIT       ,*
  33.       DATA Ready           ,BIG <>,BIGGER <<>>,THE BIGGEST <<<>>>,Quit   ,*
  34.       DATA Aim             ,EEENY,MEENY,MINEY,MOE,GO                     ,*
  35.       DATA Fire            ,One,Two,Three,Four,Five,Six,Seven,Eight,END  ,* ,$
  36.  
  37.     '____________________END OF DATA______________________
  38.  
  39.     GOSUB LoadLMenu            ' Load all menus
  40.  
  41. SetMenu:
  42.     CLS
  43.     LOCATE 12 , 25
  44.     PRINT "LMENU Line Menu Demonstration"
  45.     LOCATE 25 , 19
  46.     PRINT "Select Menu 0 -"; LMenuMax; "(anything else quits)";
  47.     GOSUB GetKeyClear        ' Get a key
  48.     Num = KeyCode - 48        ' Convert to the actual menu number
  49.     IF Num > LMenuMax                        _
  50.        OR Num < 0                            _
  51.           THEN GOTO DemoExit        ' Quit if out of bounds    
  52.     CLS
  53.  
  54. GetSelNum:
  55.     LOCATE 12 , 35
  56.     PRINT "Select One"
  57.     LOCATE 25,1            ' Locate the start of the menu line
  58.     GOSUB LMenu            ' Do the menu line 
  59.  
  60.   ' The ONLY check the subroutine does is to convert Quit to -21. All other
  61.   ' evaluation of KeyCode. or Q$ must be made in this calling program.
  62.     IF KeyCode = -21                        _
  63.        THEN GOTO SetMenu        ' Quit will ALWAYS be -21
  64.     LOCATE 12 , 34            ' Evaluate the menu selection
  65.     PRINT "You pressed"; KeyCode
  66.     Dly = 2                ' Hold for 2 seconds 
  67.     GOSUB Delay
  68.     LOCATE 12 , 34
  69.     PRINT SPC(16)
  70. GOTO GetSelNum                ' Return for further demonstration
  71.  
  72. DemoExit:
  73. SYSTEM
  74. ' >>>> Physical EOF LMENUDMO.ASC  25 June 86
  75.